<!DOCTYPE html>
<html lang="en">
<!--header-->
<include file="Public:header"/>
<!--header-->
<section id="main-content">
    <section class="wrapper">
        <h3><i class="fa fa-angle-right"></i> 添加/修改优惠券r信息</h3>

        <!-- BASIC FORM ELELEMNTS -->
        <div class="row mt">
            <div class="col-lg-12">
                <div class="form-panel">
                    <h4 class="mb">
                        <i class="fa fa-angle-right"></i> 优惠券信息
                        <a class="btn btn-theme btn-default" href="{:U('index')}">返回</a>
                    </h4>

                    <form id="myForm" class="form-horizontal style-form" method="post" action="{:U('add')}"  enctype="multipart/form-data">
                        <div class="form-group" style="display: none;">
                            <label class="col-sm-2 col-sm-2 control-label">优惠券使用方式</label>
                            <div class="col-sm-10">
                                <select  name="type" class="form-control">
                                <option value="1" <if condition="$list['type'] == 1">selected </if>>线上消费使用</option>
                                <option value="2" <if condition="$list['type'] == 2">selected</if>>到店消费使用</option>
                                </select>
                            </div>
                        </div>
                       <!-- <div class="form-group">
                            <label class="col-sm-2 col-sm-2 control-label">优惠券图片(宽750*高156)</label>
                            <div class="col-sm-10">
                                <input type="file" name="one" id="avatar" onchange='PreviewImage(this)' style="opacity: 0;display: block;cursor:pointer" />
                                <if condition="$list.img != NULL">
                                    <img class="ph-user"  src="{$list.img}" width="80" height="60" onclick="openFile()" style="cursor:pointer">
                                    <else/>
                                    <img class="ph-user" src="__PUBLIC__/img/wutu.png" alt="" width="80" height="80" onclick="openFile()" style="cursor:pointer">
                                </if>
                            </div>
                        </div>-->

                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 control-label">优惠券名称</label>
                            <div class="col-sm-10">
                                <input name="name" value="{$list.name}" placeholder="请输入名称" type="text"  class="form-control">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 control-label">满多少</label>
                            <div class="col-sm-10">
                                <input name="man" value="{$list.man}" placeholder="请输入满多少才可减免的钱数" type="text"  class="form-control">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 control-label">减免钱数</label>
                            <div class="col-sm-10">
                                <input name="money" value="{$list.money}" placeholder="请输入减免钱数" type="text"  class="form-control">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 control-label">客服电话</label>
                            <div class="col-sm-10">
                                <input name="phone" value="{$list.phone}" placeholder="请输入电话" type="text"  class="form-control">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 control-label">优惠券开始时间</label>
                            <div class="col-sm-10">
                                <input name="start_at" value="{$list.start_at}" placeholder="请输入开始时间" type="date"  class="form-control">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 control-label">优惠券结束时间</label>
                            <div class="col-sm-10">
                                <input name="end_at" value="{$list.end_at}" placeholder="请输入结束时间" type="date"  class="form-control">
                            </div>
                        </div>
                        <div class="form-group"  style="display: none;">
                            <label class="col-sm-2 col-sm-2 control-label">店面地址</label>
                            <div class="col-sm-10">
                                <input name="address" value="{$list.address}" placeholder="请输入地址" type="text"  class="form-control">
                            </div>
                        </div>
                        <div class="form-group" style="display: none;">
                            <label class="col-sm-2 col-sm-2 control-label">优惠券介绍</label>
                            <div class="col-sm-10">
                                <textarea  name="title" class="input" placeholder="请输入标题" style="width: 350px;height: 150px;"> {$list.title}</textarea>
                            </div>
                        </div>
                        <input type="hidden"  name="id" value="{$list.id}">
                        <input type="hidden"  name="img" value="{$list.img}">
                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 control-label"></label>
                            <div class="col-sm-10">
                                <input  type="submit" id="tianjia" class="btn btn-theme" value="保存" style="width: 150px;margin-left: 60px">
                                <input  type="reset" class="btn btn-warning" value="重置" style="width: 150px">
                            </div>
                        </div>
                    </form>
                </div>
            </div><!-- col-lg-12-->
        </div><!-- /row -->
    </section>
</section>
<!--footer-->
<include file="Public:footer"/>
<!--footer-->
<script>

    //图片上传
    function openFile(){
        return  $("#avatar").click();
    }
    function PreviewImage(imgFile) {
        var filextension=imgFile.value.substring(imgFile.value.lastIndexOf("."),imgFile.value.length);
        var o=imgFile.files[0];
        filextension=filextension.toLowerCase();
        if ((filextension!='.jpg')&&(filextension!='.jpeg')&&(filextension!='.png')&&(filextension!='.bmp'))
        {

            imgFile.focus();
        }else if(o.size > 2097152){
            imgFile.focus();
        }
        else
        {
            var path;
            path=window.URL.createObjectURL(imgFile.files[0]);// FF 7.0以上
            $('.ph-user').attr({src:path});
        }
    }


</script>

</body>
</html>


